package com.example.smartcity.ui.frg

import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.smartcity.R
import com.example.smartcity.adapter.XThemeListAdapter
import com.example.smartcity.http.XThemeBean
import com.example.smartcity.ui.act.HlxzActivity
import kotlinx.android.synthetic.main.fragment_main_tab3.*

/**
 * @Author: Tailyou(祝文飞)
 * @CreateDate: 2021/10/7 14:52
 * @Description: 限选主题
 */
class MainEnterFrg3 : Fragment(R.layout.fragment_main_tab3) {

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        var datas: List<XThemeBean> = mutableListOf(
            XThemeBean("精准扶贫", R.mipmap.ic_jzfp, 5),
            XThemeBean("智慧社区", R.mipmap.ic_zhsq, 1),
            XThemeBean("智慧党建", R.mipmap.ic_zhdj, 2),
            XThemeBean("智慧环保", R.mipmap.ic_zhhb, 3),
            XThemeBean("智慧养老", R.mipmap.ic_zhyl, 4),
            XThemeBean("中国智造", R.mipmap.ic_zgzz, 6),
            XThemeBean("航旅助手", R.mipmap.ic_sdkm, 7)
        )
        val linearLayoutManager = LinearLayoutManager(activity)
        linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
        rvXTheme.layoutManager = linearLayoutManager
        rvXTheme.adapter = XThemeListAdapter(datas, object : XThemeListAdapter.OnItemClickListener {
            override fun onClick(position: Int) {
                if (position == 6) {
                    val intent = Intent(activity, HlxzActivity::class.java)
                    startActivity(intent)
                }
            }
        })
    }

}